﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LinqAndLambda.Modules
{
    public class Concat_Union_intersect
    {
        public static void mian()
        {
            int[] num1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            int[] num2 = { 1, 3, 5, 7, 9, 11 };

            //Concat  :连接两个序列(有重复元素)  
            var numbers = num1.Concat(num2);

            //Union  :连接两个序列(无重复元素)  
            numbers = num1.Union(num2);

            //Intersect:  交集
            numbers = num1.Intersect(num2);

            //Except : 差集
            numbers = num1.Except(num2);

            foreach (var item in numbers)
            {
                Console.WriteLine(item);
            }
        }
    }
}
